package com.bank.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: Lixy
 * @email: 1908598362@qq.com
 * @date: 2022/2/1 星期二 21:38
 */

@Configuration
public class RabbitMQConfig {
    private static final String QUEUE = "SeckillQueue";
    private static final String EXCHANGE = "SeckillExchange";


    @Bean
    public Queue queue() {
        return new Queue(QUEUE);
    }

    @Bean
    public TopicExchange topicExchange() {
        return new TopicExchange(EXCHANGE);
    }

    @Bean
    public Binding binding() {
        return BindingBuilder.bind(queue()).to(topicExchange()).with("seckill.#");
    }
}

